package cn.jilian.entity;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import cn.jilian.entity.AbstractEntity;

/**
 * 机构
 * */ 
@Entity
@Table(name="bt_unit",uniqueConstraints = @UniqueConstraint(name="unitUniqueByText",columnNames = {"fid", "text" }))
@DynamicInsert
@DynamicUpdate
@DiscriminatorColumn(name="meta",discriminatorType=DiscriminatorType.INTEGER)
public class Unit extends AbstractEntity{

	/**
	 * 
	 */
	private static final long serialVersionUID = -3196827042744075308L;

	public static final Integer RANK=210007;
	
	public static final Long GROUP_ID=3001103001L;
	
	/**
	 * 平台
	 * */
	public static final String PLATFORM_META="539126";

	/**
	 * 货源商
	 * */ 
	public static final String SUPPLIER_META="539127";

	/**
	 * 物流公司
	 * */ 
	public static final String TRANS_META="539128";
	
	public static final Map<Long,Class<? extends Unit>> METACLASSMAP=new HashMap<>();
	
	static {
		METACLASSMAP.put(539126L, PlatformUnit.class);
		METACLASSMAP.put(539127L, SupplierUnit.class);
		METACLASSMAP.put(539128L, TransUnit.class);
	}

	
	public Unit() {
		setFid(GROUP_ID);
		setRank(RANK);
	}
	/**
	 * 英文名
	 * */ 
	
	@Column(name="name")
	private String name;

	
	/**
	 * 社会统一信用代码
	 * */ 
	@Column(name="code")
	private String creditCode;

	
	/**
	 * 机构名
	 * */ 
	@Column(name="text",unique=true)
	private String text;

	
	/**
	 * 邮箱
	 * */ 
	@Column(name="mail")
	private String mail;

	
	/**
	 * 网址
	 * */ 
	@Column(name="site")
	private String site;

	
	/**
	 * 状态
	 * */ 
	@Column(name="flag")
	private Integer status;

	
	
	/**
	 * 收款银行
	 * */ 
	@Column(name="acct_bank")
	private String acctBank;

	
	/**
	 * 收款账号
	 * */ 
	@Column(name="acct_no")
	private String acctNo;

	@Embedded
	private ContactInfo contactInfo;
	
	
	@Column(name="TIMS")
	private Date tims;

	

	public String getCreditCode(){
		return this.creditCode;
	}

	public void setCreditCode(String creditCode){
		this.creditCode=creditCode;
	}


	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}


	public  Integer getRank() {
		return RANK;
	}


	public String getMail(){
		return this.mail;
	}

	public void setMail(String mail){
		this.mail=mail;
	}

	public String getSite(){
		return this.site;
	}

	public void setSite(String site){
		this.site=site;
	}

	public Integer getStatus(){
		return this.status;
	}

	public void setStatus(Integer status){
		this.status=status;
	}

	public String getAcctBank(){
		return this.acctBank;
	}

	public void setAcctBank(String acctBank){
		this.acctBank=acctBank;
	}

	public String getAcctNo(){
		return this.acctNo;
	}

	public void setAcctNo(String acctNo){
		this.acctNo=acctNo;
	}
	

	public ContactInfo getContactInfo() {
		return contactInfo;
	}

	public void setContactInfo(ContactInfo contactInfo) {
		this.contactInfo = contactInfo;
	}

	public Date getTims() {
		return tims;
	}

	public void setTims(Date tims) {
		this.tims = tims;
	}


}